package com.xiaolin.springbootdemo.controller;

import com.xiaolin.springbootdemo.model.Account;
import com.xiaolin.springbootdemo.service.AccountService;
import com.xiaolin.springbootdemo.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName AccountController
 * @Description 描述
 * @Detail detail
 * @Author MyPC
 * @Date 2021/1/10
 * @Version 1.0
 */
@RestController
@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService accountService;

    @GetMapping("/list")
    public ResponseResult<List<Account>> queryList(@RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
                                                   @RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize){
        List<Account> accounts = accountService.queryList(pageNum,pageSize);
        return ResponseResult.success(accounts);
    }
}
